<template>
  <div class="container">
     <div class="title">
      新人必听
     </div>
     <div class="body">
      <albumCard :type="1" v-for="item in albums" :key="item.albumId" :item="item"></albumCard>
     </div>
  </div>
</template>

<script setup lang="ts">
import albumCard from './album-card.vue';
import {reqNewPeople} from '../../../api/home/index'
import { onMounted, ref } from 'vue';
import { albumsItem } from '../../../api/home/type';
//新人必听列表数据
let albums=ref<albumsItem[]>([]);

//生命周期函数

onMounted(()=>{
  getalbumsData();
});


//请求新人必听的功能函数
const getalbumsData=async()=>{
  try {
    let res=await reqNewPeople(1,6);
    if(res.ret==200){
      albums.value=res.data.albums;
    }
  } catch (error) {
    console.log(error);
  }
}



</script>

<style lang="less" scoped>
.container{
  padding: 0 15px;
}
.title{
  margin:17px 0 17px 5px;
  font-size:18px;
  color:#40404C;
  font-weight: bold;
}
.body{
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
}
</style>